package com.util;

import java.time.*;
import java.time.format.*;
import java.util.*;

/**
 * AIKA
 * 2023/9/8
 */


public class Generator {

    //public static final String No = "ZS.";

    /**
     * 生成当前年月日的8位string
     */
    public static String dateCode() {
        return LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
    }


    /**
     * 随机生成n个大写字母
     */
    public static String randomChar(int size) {
        Random random = new Random();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < size; i++) {
            char randomChar = (char) (random.nextInt(26) + 'A');
            sb.append(randomChar);
        }
        return sb.toString();
    }

    /**
     * 受理流水号
     */
    public static String acceptNo() {
        return dateCode() + "-" + randomChar(7);
    }


    /**
     * 随机生成100以内数字
     */
    public static Integer hundred() {
        return new Random().nextInt(100);
    }

    /**
     * 随机生成max以内数字
     */
    public static String randomStr(Integer max) {
        return String.valueOf(new Random().nextInt(max));
    }
    /**
     * 随机生成max以内数字
     */
    public static Integer randomInteger(Integer max) {
        return new Random().nextInt(max);
    }

    /**
     * 随机生成100000以内string数字
     */
    public static String strMillion() {
        return String.valueOf(new Random().nextInt(10000));
    }


}
